<%@ page import="connect.InfoDao" %>
<%@ page import="java.util.List" %>
<%@ page import="model.Info" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Destination</title>
</head>
<body>
<jsp:include page="top3.jsp"/>
<%
    InfoDao infoDao = new InfoDao();
    //先获取状态为1的交易单号列表
    List<Integer> tradelist = infoDao.getTradeByStatus(1);
%>
<!-- service section -->
<section class="service_section layout_padding">
    <div class="container">
        <div class="heading_container">
            <h2>
                物流收货地
            </h2>
        </div>

        <div class="service_container">
            <%
                for (int i = 0; i < tradelist.size(); i++) {
                    int trade=tradelist.get(i);
            %>
            <div class="box">
                <div class="detail-box">
                    <table align="center" cellspacing="0">
                        <tr  style="font-size: 20px;height:60px;text-align: center">
                            <td style="width:100px">订单号</td>
                            <td style="width: 100px">用户名</td>
                            <td style="width: 100px">价格</td>
                            <td style="width: 100px">物流</td>

                        </tr>
                        <%
                            List<Info> infoList = infoDao.getInfoByTradeAndStatus(trade,1);
                            int org=1;
                            if(infoList.get(0).getOrg()=="蓝天物流"){
                                org=1;
                            }
                            else{
                                org=2;
                            }
                            for (int j=0;j<infoList.size();j++){
                                Info in=infoList.get(j);
                        %>
                        <tr style="height:40px;text-align: center">
                            <td><%=in.getId()%>
                            </td>
                            <td><%=in.getName()%>
                            </td>
                            <td><%=in.getPrice()%>
                            </td>
                            <td><%=in.getOrg()%>
                            </td>

                        </tr>
                        <%
                            }
                        %>
                        <tr style="height:30px;text-align: center"></tr>
                    </table>

                    <div class="btn-box">
                        <a href="destinationDo.jsp?status=1&org=<%=org%>&trade=<%=trade%>">
                            确认货物已送达
                        </a>
                    </div>
                </div>
            </div>
            <%
                }
            %>

        </div>
    </div>
</section>
<!-- end service section -->
<jsp:include page="footer.jsp"/>

</body>
</html>
